package com.zys.exercise;

import java.util.TreeMap;

public class text3 {
    public static void main(String[] args) {
        String s = "aababcabcdabcde";
        TreeMap<Character,Integer> tm = new TreeMap<>();
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            if (tm.containsKey(c)) {
                int count = tm.get(c);
                count++;
                tm.put(c,count);

            }
            else{
                tm.put(c,1);
            }
        }
        System.out.println(tm);

    }
}
